<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'base.item.class.php');

class VoteSurveyBase extends BaseItemBase {
	
	//constructor
	function VoteSurveyBase() {
		parent::BaseItemBase();
		
		$this->table = 'pp_votes_survey';
		$this->prefix = 'vs_';
		
		$this->format = true;
		
		$this->search_fields = array('name');
		$this->sort_fields = array('sort_order+', 'name+', 'id+');
	}
	
	//methods
	function checkItemExpired($item) {
		if( $this->_is_expire($item['start_time'], $item['end_time']) ) {
			return true;
		}
		
		return false;
	}
	
	//private
	function _get_query_str_custom($filter = '', $check = 0) {
		$query_str = "";
		$query_str .= " and " . $this->prefix . "start_time >= now() ";
		$query_str .= " and " . $this->prefix . "end_time <= now() ";
		
		return $query_str;
	}
}
//
?>